using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class PatReferralMap : EntityTypeConfiguration<PatReferral>
    {
        public PatReferralMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.PATIENT)
                .HasMaxLength(50);

            this.Property(t => t.REFERRALTYPE)
                .HasMaxLength(50);

            this.Property(t => t.REF_PHYS)
                .HasMaxLength(6);

            this.Property(t => t.REF_PHYS_INT)
                .HasMaxLength(6);

            this.Property(t => t.REF_PHYS_EXT)
                .HasMaxLength(50);

            this.Property(t => t.DIAGNOSIS)
                .HasMaxLength(50);

            this.Property(t => t.NOTE)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("PatReferral");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.PATIENT).HasColumnName("PATIENT");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.REFERRALTYPE).HasColumnName("REFERRALTYPE");
            this.Property(t => t.REF_PHYS).HasColumnName("REF_PHYS");
            this.Property(t => t.REF_PHYS_INT).HasColumnName("REF_PHYS_INT");
            this.Property(t => t.REF_PHYS_EXT).HasColumnName("REF_PHYS_EXT");
            this.Property(t => t.DIAGNOSIS).HasColumnName("DIAGNOSIS");
            this.Property(t => t.NOTE).HasColumnName("NOTE");
        }
    }
}
